//
//  NAToolView.m
//  NewApp
//
//  Created by  on 12-7-16.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "NAToolView.h"


@interface NAToolView(Private)

/**
 *  Build UI interface
 */
- (void) buildUserInterface;

@end

@implementation NAToolView
@synthesize  confirmButton,countTextfield,itemNoLabel,priceLabel;

- (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self buildUserInterface];
    }
    return self;
}

- (void) dealloc {
    [confirmButton release];
    [countTextfield release];
    [itemNoLabel release];
    [priceLabel release];
    [super dealloc];
}

- (void) buildUserInterface {
    UIImageView *backgroundView = [[UIImageView alloc] initWithFrame:self.bounds];
    backgroundView.image = [UIImage imageNamed:@"index2_text_bg.png"];
    [self addSubview:backgroundView];
    [backgroundView release];
    
    UILabel *itemNoLbl = [[UILabel alloc] initWithFrame:CGRectMake(3.f, 3.f, 170.f, 20.f)];
    itemNoLbl.backgroundColor = [UIColor clearColor];
    itemNoLbl.textColor = [UIColor whiteColor];
    itemNoLbl.font = [UIFont systemFontOfSize:13.f];
    itemNoLbl.text = @"型號：XA454542123644";
    self.itemNoLabel = itemNoLbl;
    [itemNoLbl release];
    [self addSubview:self.itemNoLabel];
    
    UILabel *priceLbl = [[UILabel alloc] initWithFrame:CGRectMake(3.f, 24.f, 170.f, 20.f)];
    priceLbl.backgroundColor = [UIColor clearColor];
    priceLbl.textColor = [UIColor whiteColor];
    priceLbl.font = [UIFont systemFontOfSize:13.f];
    priceLbl.text = @"定價：180$ 特價：154$";
    self.priceLabel  = priceLbl;
    [self addSubview:self.priceLabel];
    [priceLbl release];
    
    UITextField *tf = [[UITextField alloc] initWithFrame:CGRectMake(150.f, 7.f, 75.f, 31.f)];
    tf.borderStyle = UITextBorderStyleRoundedRect;
    tf.placeholder = @"輸入數量";
    tf.font = [UIFont systemFontOfSize:14.f];
    tf.adjustsFontSizeToFitWidth = YES;
    self.countTextfield = tf;
    [self addSubview:self.countTextfield];
    [tf release];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setBackgroundImage:[UIImage imageNamed:@"confirm_button.png"] forState:UIControlStateNormal];
    button.frame = CGRectMake(230.f, 7.f, 60.f, 30.f);
    [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [button setTitle:@"詢價" forState:UIControlStateNormal];
    self.confirmButton = button;
    [self addSubview:self.confirmButton];
}

@end
